/** 
 *  全局需要混入方法的地方使用
 */
export default {
    data() {
        return {
            
        }
    },
    watch: {
        show(val) {
          const searchBox = document.querySelector('.search-and-button')
          if (!val) {
            searchBox.style.height = '40px'
          } else {
            searchBox.style.height = '95px'
            this.changeHeight(searchBox)
          }
        }
      },
    created() {
        
    },
    mounted() {
        window.onresize = () => {
            const searchBox = document.querySelector('.showSearch')
            this.changeHeight(searchBox)
          }
    },
    beforeDestroy() {
      window.onresize = null
    },
    methods: {
            /**
     * @description: height change
     * @param {*} searchBox
     * @return {*}
     */
    changeHeight(searchBox) {
        if (searchBox) {
          const clientWidth = document.documentElement.clientWidth
          if (clientWidth < 1440) {
            searchBox.style.height = '135px'
          }
          if (clientWidth < 850) {
            searchBox.style.height = '175px'
          }
          if (clientWidth > 1440) {
            searchBox.style.height = '95px'
          }
        }
      },
    }
}